package com.h3c.nem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.h3c.nem.dto.TbTeacherAllowanceDTO;
import com.h3c.nem.dto.TbTeacherDTO;
import com.h3c.nem.entity.SdAllWorker;
import com.h3c.nem.entity.TbTeacher;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Copyright (C), 2020-2020, h3c
 * FileName: TbTeacherMapper
 *
 * @Author: l22886
 * @Date: 2022-01-19
 * Description: tb_teacher mapper
 * Version: 1.0
 */
public interface TbTeacherMapper extends BaseMapper<TbTeacher> {

    /**
     * @title: queryListByFuzzy
     * @description: 模糊列表查询
     * @params: [ TbTeacher ]
     * @return: java.util.List
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public List<TbTeacher> queryListByFuzzy( @Param("teacher")TbTeacher TbTeacher, @Param("deptIdList") List<Integer> deptList,@Param("teacherIdList") List<String> teacherList);

    /**
     * @title: queryListByFuzzy
     * @description: 精确列表查询
     * @params: [ TbTeacher ]
     * @return: java.util.List
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public List<TbTeacher> queryList(TbTeacher TbTeacher);

    /**
     * @title: updateTbTeacher
     * @description: 更新
     * @params: [ TbTeacher ]
     * @return: java.lang.Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer updateTbTeacher(TbTeacher TbTeacher);

    /**
     * @title: insertTbTeacher
     * @description: 插入
     * @params: [ TbTeacher ]
     * @return: java.lang.Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer insertTbTeacher(TbTeacher TbTeacher);

    /**
     * @title: deleteTbTeacher
     * @description: 删除
     * @params: [ TbTeacher ]
     * @return: java.lang.Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer deleteTbTeacher(TbTeacher TbTeacher);

    List<TbTeacher> getTeacherByKeyWord(String key);

    List<TbTeacherAllowanceDTO> getTeacherAllowance(TbTeacherDTO params);

    @Select("select 1 from tb_teacher where teacher_id = #{workerId} limit 1")
    public Integer checkIsTeacher (@Param("workerId")  String workerId);

    /**
     * 3、4级部门下不是导师的人
     * @return
     */
    @Select("select * from sd_all_worker where worker_id not in(select teacher_id from tb_teacher) and (dept3id is not null or dept4id is not null) and worker_id not like '9%' and worker_type = 1")
    List<SdAllWorker> selectWorkerNotTeacher();
}
